<!DOCTYPE html>
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>我的小屋</title>
    <link rel="stylesheet" th:href="@{/layui-v2.6.4/layui/css/layui.css}" type="text/css"/>
    <link rel="stylesheet" th:href="@{/layui-v2.6.4/layui/css/modules/code.css}" type="text/css"/>
    <script th:src="@{/js/jquery-3.5.1.min.js}"></script>
    <script charset="utf-8" th:src="@{/layui-v2.6.4/layui/layui.js}" type="text/javascript"></script>
    <script>
        layui.use('element', function () {
            var element = layui.element;
        });
    </script>
</head>
<body>
<div class="div_top" th:replace="include/top"></div>
<div class="layui-container" id="firstDiv" style="height: 190px;width: 90%">
    <div class="layui-row"
         style="width: 100%;height: 100%; background: url('../img/bilibili.jpg')">
        <div class="layui-col-md2 layui-col-lg2 layui-col-sm2 layui-col-xs2 layui-row" style="height: 100%;">
            <div class="layui-col-md12 layui-col-lg12 layui-col-sm12 layui-col-xs12 layui-row" style="height: 17%;">
            </div>
            <div class="layui-col-md8  layui-col-md-offset2 layui-col-lg8  layui-col-lg-offset2 layui-col-sm8  layui-col-sm-offset2 layui-col-xs8  layui-col-xs-offset2 layui-row"
                 style="height: 66%; width: 66%;">
                <img class="layui-col-md12 layui-col-lg12 layui-col-sm12 layui-col-xs12 layui-circle"
                     src="http://localhost:9876/img/bg.jpg"
                     style="height: 100%;">
            </div>
            <div class="layui-col-md12 layui-col-lg12 layui-col-sm12 layui-col-xs12 layui-row"
                 style="text-align: center;margin: auto;height: 17%;">
            </div>
        </div>
        <div class="layui-col-md10 layui-col-lg10 layui-col-sm10 layui-col-xs10 " style="height: 100%;">
            <div class="layui-row" style="height: 83%;">
                <div class="layui-col-md12 layui-col-lg12 layui-col-sm12 layui-col-xs12 " style="height: 20%;"></div>
                <div class="layui-col-md12 layui-col-lg12 layui-col-sm12 layui-col-xs12  layui-row"
                     style="height: 30%;">
                    <div class="layui-col-md5  layui-col-lg5 layui-col-sm5 layui-col-xs5 "
                         style="height: 100%; font-size:20px;">
                        <b>
                            <div style="color:red;"><b id="pname" name="pname" th:text="${comUser.userPname}"></b>&nbsp;&nbsp;<i
                                    class="layui-icon layui-icon-male"></i></div>
                        </b>
                    </div>
                    <div class="layui-col-md1 layui-col-md-offset5 layui-col-lg1 layui-col-lg-offset5 layui-col-sm1 layui-col-sm-offset5 layui-col-xs1 layui-col-xs-offset5"
                         style="height: 100%;width:10%">
                        <button class="layui-btn  layui-btn-xs layui-col-md12 layui-col-lg12 layui-col-sm12 layui-col-xs12"
                                style="height: 45%;background-color: #d32f2f;	"
                                type="button">
                            <a th:href="@{/fadan/}+${sysUser.id}" th:onclick="return task([[${sysUser.id}]])"
                               target="iframe" style="color: white;"><b
                                    style="font-size:1px;"><i class="layui-icon layui-icon-user"></i>发布任务</b></a>
                        </button>

                    </div>
                </div>
                <div class="layui-col-md12  layui-col-lg12 layui-col-sm12 layui-col-xs12" style="height: 20%;">
                    <b style="font-size: 2px;color: black;">简介:&nbsp;&nbsp;</b><b id="jianjie" name="jianjie"
                                                                                  style="font-size: 2px;color:#666666 ;"
                                                                                  th:text="${comUser.userDec}"></b>
                </div>
                <!-- 第四 -->
                <div class="layui-col-md12 layui-col-lg12 layui-col-sm12 layui-col-xs12" style="height: 30%;">
                    <div class="layui-col-md12 layui-col-lg12 layui-col-sm12 layui-col-xs12" style="height:50%"></div>
                    <div class="layui-col-md4 layui-col-lg4 layui-col-sm4 layui-col-xs4 layui-row"
                         style="height:50%;color:black;font-size:14px;">
                        <b style="height:50%;color:black;font-size:14px;" th:if="${sysUser.userRole .equals('agent')}">信誉等级:代理人</b>
                        <b style="height:50%;color:black;font-size:14px;"
                           th:if="${sysUser.userRole .equals('complete')}">信誉等级:委托人</b>&nbsp;&nbsp;
                        <i class="layui-icon layui-icon" id="i"
                           th:onmouseover="blur1([[${sysUser.userRole}]])">&#xe60b;</i>
                    </div>
                    <div name="Money" id="Money"
                         class="layui-col-md2 layui-col-md-offset6 layui-col-lg2 layui-col-sm2 layui-col-xs2"
                         style="font-weight: bold; height:50%;color: black;font-size:14px;"
                         th:text="'账户资产:'+${comUser.userMoney}"></div>

                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        function task(id) {
            var bol = false;
            $.ajax({
                url: "/task"
                , type: 'get'
                , async: false
                , data: {
                    id: id
                }
                , success: function (res) {
                    if (res != "agent") {
                        bol = true;
                    } else {
                        bol = false;
                        layer.confirm('您当前不能发布任务,需要50¥升级', {
                            btn: ['升级', '取消'] //按钮
                        }, function () {
                            $.ajax({
                                url: "/task1"
                                , type: 'get'
                                , async: false
                                , data: {
                                    id: id
                                }
                                , success: function (test) {
                                    if (test == "ok") {
                                        layer.msg('升级成功', {icon: 1});
                                        setTimeout(function () {
                                            location.assign("/userHome/" + id);
                                        }, 1000);
                                        bol = true;
                                    } else {
                                        layer.msg('余额不足,请充值', {icon: 1});
                                        bol = false;
                                    }
                                }
                            })
                        }, function () {
                            bol = false;
                        });
                    }
                }

            });
            return bol;
        }

        function blur1(str) {
            if (str == ("agent")) {
                layer.tips('可以接受任务', '#i');
            }
            if (str == ("complete")) {
                layer.tips('可以接受任务和发布任务', '#i');
            }
        }

        function aaaaa() {
            alert("ok")
        }
    </script>
</div>
<div class="layui-container" style="width: 90% ;">
    <div class="layui-row">
        <div class="layui-col-md2 layui-col-md2 layui-col-lg2 layui-col-sm2 layui-col-xs2">
            <ul class="layui-nav layui-nav-tree" lay-filter="test" style="background:#2d1739">
                <li class="layui-nav-item layui-nav-itemed">
                    <a th:href="@{/money/}+${sysUser.id}" target="iframe"><i class="layui-icon layui-icon-dollar"></i>账户资产</i>
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a th:href="@{/money/}+${sysUser.id}" target="iframe">在线充值</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a th:href="@{/Issuedbill/}+${sysUser.id}" target="iframe"><i
                            class="layui-icon layui-icon-set-fill"></i> 悬赏管理</a>
                    <dl class="layui-nav-child">
                        <dd><a th:href="@{/Issuedbill/}+${sysUser.id}" target="iframe">已发布</a></dd>
                        <dd><a th:href="@{/toJieDan/}+${sysUser.id}" target="iframe">已被接</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a target=移动模块"iframe"><i class="layui-icon layui-icon-list"></i> 我的任务</a>
                    <dl class="layui-nav-child">
                        <dd><a target="iframe" th:href="@{/myentIngOrder(id=${sysUser.id})}">进行中</a></dd>
                        <dd><a target="iframe" th:href="@{/myentEndOrder(id=${sysUser.id})}">已完成</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a target="iframe"><i class="layui-icon layui-icon-reply-fill"></i> 我的消息</a>
                    <dl class="layui-nav-child">
                        <dd><a th:href="@{/Articlemessages/}+${sysUser.id}" target="iframe">我的帖子</a></dd>
                        <dd><a th:href="@{/ArticleDelmessages/}+${sysUser.id}" target="iframe">回收站</a></dd>
                        <dd><a th:href="@{/aaa/}+${sysUser.id}" target="iframe">系统消息</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a target="iframe" th:href="@{/baseInfo/}+${sysUser.id}"><i
                            class="layui-icon layui-icon-user"></i> 个人信息</a>
                    <dl class="layui-nav-child">
                        <dd><a target="iframe" th:href="@{/baseInfo/}+${sysUser.id}">基本信息</a></dd>
                        <dd><a target="iframe" th:href="@{/rev/}+${sysUser.id}">修改信息</a></dd>
                        <dd><a target="iframe" th:href="@{/retPsw/}+${sysUser.id}">修改密码</a></dd>
                        <dd><a target="iframe" th:href="@{/proPsw/}+${sysUser.id}">密码保护</a></dd>
                        <dd><a target="iframe" th:href="@{/JWset/}+${sysUser.id}">设置位置</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
        <div class="layui-col-md10 layui-col-md10 layui-col-lg10 layui-col-sm10 layui-col-xs10">
            <iframe frameborder="0" height="600px" id="mainFrame" name="iframe"
                    onload='fun1()' scrolling="no"
                    th:src="@{/baseInfo/}+${sysUser.id}"
                    width="100%">
            </iframe>
        </div>
    </div>
</div>
<script>
    function IFrameReSize(iframename) {
        var pTar = document.getElementById(iframename);
        if (pTar) {  //ff
            if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight) {
                pTar.height = pTar.contentDocument.body.offsetHeight + 50;
                if (pTar.height < 600) {
                    pTar.height = 600;
                }
            } //ie
            else if (pTar.Document && pTar.Document.body.scrollHeight) {
                pTar.height = pTar.Document.body.scrollHeight + 50;
                if (pTar.height < 600) {
                    pTar.height = 600;
                }
            }
        }
    }
    function fun1() {
        var timer1 = window.setInterval(function () {
            IFrameReSize("mainFrame");
        }, 500);
    }

</script>

</body>
</html>

